import { RouterView } from 'vue-router';

import routerPlatform from '../platform-page';

const routes = [
  {
    path: '/profile',
    component: RouterView,
    children: [
      {
        path: '',
        name: 'Profile',
        component: () => import('./views/ProfilePage.vue'),
        meta: {
          title: '个人中心',
          hideNavBar: true,
        },
      },
      {
        path: 'edit',
        name: 'ProfileEdit',
        component: () => import('./views/ProfileEdit.vue'),
        meta: {
          title: '编辑资料',
          requiresBack: true,
          requiresAuth: true,
          hideFooter: true,
        },
      },
      {
        path: 'password',
        name: 'ChangePassword',
        component: () => import('./views/ChangePassword.vue'),
        meta: {
          title: '修改密码',
          requiresBack: true,
          requiresAuth: true,
          hideFooter: true,
        },
      },
      {
        path: 'feedback',
        name: 'FeedBack',
        component: () => import('./views/FeedBack.vue'),
        meta: {
          title: '意见反馈',
          requiresBack: true,
          requiresAuth: true,
          hideFooter: true,
        },
      },
    ],
  },
  {
    path: '/records',
    component: RouterView,
    children: [
      {
        path: 'sell',
        name: 'SellRecords',
        component: () => import('./views/SellRecords.vue'),
        meta: {
          title: '卖卡记录',
          requiresBack: true,
          requiresAuth: true,
          hideFooter: true,
        },
      },
      {
        path: 'sell/:id',
        name: 'RecordDetail',
        component: () => import('./views/RecordDetail.vue'),
        meta: {
          title: '卡单详情',
          hideNavBar: true,
          hideFooter: true,
        },
      },
      {
        path: 'fund',
        name: 'TransactionRecords',
        component: () => import('./views/TransactionRecords.vue'),
        meta: {
          title: '资金明细',
          requiresBack: true,
          requiresAuth: true,
          hideFooter: true,
        },
      },
      {
        path: 'withdraw',
        name: 'WithdrawRecords',
        component: () => import('./views/WithdrawRecords.vue'),
        meta: {
          title: '提现记录',
          requiresBack: true,
          requiresAuth: true,
          hideFooter: true,
        },
      },
    ],
  },
  {
    path: '/withdraw',
    component: RouterView,
    children: [
      {
        path: 'action',
        name: 'WithdrawAction',
        component: () => import('./views/WithdrawAction.vue'),
        meta: {
          title: '提现',
          requiresBack: true,
          requiresAuth: true,
          hideFooter: true,
        },
      },
      {
        path: 'account',
        name: 'WithdrawAccount',
        component: () => import('./views/WithdrawAccount.vue'),
        meta: {
          title: '提现账号',
          requiresBack: true,
          requiresAuth: true,
          hideFooter: true,
        },
      },
    ],
  },
  {
    path: '/platform',
    component: RouterView,
    children: [
      {
        path: '',
        name: 'PlatForm',
        component: () => import('./views/PlatForm.vue'),
        meta: {
          title: '平台协议',
          requiresBack: true,
          hideFooter: true,
        },
      },
      ...routerPlatform,
    ],
  },
  {
    path: '/auth',
    component: RouterView,
    children: [
      {
        path: 'real',
        name: 'RealAuth',
        component: () => import('./views/RealAuth.vue'),
        meta: {
          title: '实名认证',
          requiresBack: true,
          requiresAuth: true,
          hideFooter: true,
        },
      },
      {
        path: 'wx',
        name: 'WxAuth',
        component: () => import('./views/WxAuth.vue'),
        meta: {
          title: '绑定微信',
          requiresBack: true,
          requiresAuth: true,
          hideFooter: true,
        },
      },
      {
        path: 'ali-cloud-real',
        name: 'AliCloudRealAuth',
        component: () => import('./views/AliCloudRealAuth.vue'),
        meta: {
          title: '阿里云实名认证协议',
          requiresBack: true,
          hideFooter: true,
        },
      },
      {
        path: 'real-info',
        name: 'RealAuthInfo',
        component: () => import('./views/RealAuthInfo.vue'),
        meta: {
          title: '认证结果',
          requiresBack: true,
          hideFooter: true,
        },
      },
    ],
  },
  {
    path: '/ali-cloud-callback', // certifyId
    name: 'AliCloudCallback',
    component: () => import('./views/AliCloudCallback.vue'),
    meta: {
      title: '认证结果',
      requiresBack: true,
      hideFooter: true,
    },
  },
];

export default routes;
